//
//  String_Extension.swift
//  CXSwiftWB
//
//  Created by meidaeriOS on 2017/6/1.
//  Copyright © 2017年 meidaer. All rights reserved.
//

import UIKit

extension String {
    
    /// 快速返回一个文档目录的路径
    func docDir() -> String {
        let docPath = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true).last
        return (docPath?.appending("/" + self))!
    }
    
    /// 快速返回一个缓存目录的路径
    func cacheDir() -> String {
        let cachePath = NSSearchPathForDirectoriesInDomains(.cachesDirectory, .userDomainMask, true).last
        return (cachePath?.appending("/" + self))!
    }
    
    /// 快速返回一个临时目录的路径
    func tmpDir() -> String {
        let tmpPath = NSTemporaryDirectory()
        return tmpPath.appending("/" + self)
    }
    
}
